
D=$$
Log=$(HOME)/tmp
Dirp= if [ ! -d $d ]; then echo making $d; mkdir $d; fi;
Swaps=$(shell find . -name ".*swp")
Olds=$(shell  find . -name "*~")
Baks=$(shell  find . -name "*bak")
Fasls=$(shell find . -name "*fasl")
Doomed=$(Swaps) $(Olds) $(Fasls) $(Baks)
Emacs=emacs
MacEmacs=/Applications/Emacs.app/Contents/MacOS/Emacs

help    :  #: show help
	@  printf "\nmake COM (where 'COM' is one of...)\n\n" 
	@ cat Makefile | \
	gawk  -F\: 'NF> 2 && /^[a-zA-Z]*[\t ]*:/  {print $(D)1 ":" $(D)3}' | \
	sort | cat -n

log     :          #: generate a log of user activity 
	cd .. && svn log | fgrep '|' | cut -d\  -f 3,8,9,10,11  | sort | uniq -c > $(Log).whoday
	cd .. && svn log | fgrep '|' | cut -d\  -f 3  | sort | uniq -c | sort -rn > $(Log).who      
	@printf  "\n\n---| who day |------------------------------\n"
	@cat	$(Log).whoday
	@printf  "\n\n---| who |------------------------------\n"
	@cat $(Log).who

create :        #: make a new app. usage make create App=something
	@mkdir lib/$(App)
	@cp -rn lib/eden/ lib/$(App)
	@cp -n lib/eden.asd lib/$(App).asd
	@echo "I have created [$(App)]. Now you need to change the following lines:"
	@echo ""
	@fgrep -Hn App lib/$(App).asd lib/$(App)/*.lisp

commit  : clean #: save work to repository
	svn commit 

update  :  #: update work from repository
	svn update

clean   :    #: delete editor temporary files  
	- $(foreach f, $(Doomed),  rm $f; )

edit    :        #: general edit
	@cd lib && $(Emacs) iccle.lisp

macedit :        #: os/x edit                
	@make Emacs="$(MacEmacs)" edit & 

status  :        #: show modified, new files
	@svn status | \
	grep -v Thumbs.db | grep -v .DS_Store | grep -v \.fasl | grep -v \~ | \
	gawk '/?/ {Seen++; print "svn add " $(D)2  }  END {if (Seen) print ""}'
